package com.stephen.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import xyz.erupt.core.annotation.EruptScan;

import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

/**
 * Created by stephen on 2021-03-30 11:26 .
 * Description:
 */
@ComponentScan({"xyz.erupt", "com.stephen.demo"}) // ↓ xyz.erupt必须有
@EntityScan({"xyz.erupt", "com.stephen.demo"})    // ↓ 如果包名com.example.demo有变化
@EruptScan({"xyz.erupt", "com.stephen.demo"})     // → 要修改为变化后的包名
@SpringBootApplication
public class EruptMain extends SpringBootServletInitializer {

    public static void main(String[] args) throws URISyntaxException, IOException {
        SpringApplication.run(EruptMain.class,args);
        System.setProperty("java.awt.headless", "false");
        Desktop.getDesktop().browse(new URI("http://localhost:8080"));
    }

    //打WAR包的配置
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(EruptMain.class);
    }
}
